package org.rambadger.command.event;

import org.rambadger.command.auth.PlatformRole;
import org.rambadger.command.validation.UrlIdentifier;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

public abstract class PlatformRoleChanged {
    protected final String username;
    protected final String platform;
    protected final PlatformRole role;

    protected PlatformRoleChanged(String username, String platform, PlatformRole role) {
        this.username = username;
        this.platform = platform;
        this.role = role;
    }

    @UrlIdentifier @NotNull
    public String getUsername() {
        return username;
    }

    @UrlIdentifier @NotNull
    public String getPlatform() {
        return platform;
    }

    @NotNull
    public PlatformRole getRole() {
        return role;
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName()+"{" +
                "username='" + username + '\'' +
                ", platform='" + platform + '\'' +
                ", role=" + role +
                "}";
    }

    public static class PlatformRoleGranted extends PlatformRoleChanged implements Serializable {
        private static final long serialVersionUID = 3799930014969853608L;

        public PlatformRoleGranted(String username, String platform, PlatformRole role) {
            super(username, platform, role);
        }


    }

    public static class PlatformRoleRevoked extends PlatformRoleChanged implements Serializable {
        private static final long serialVersionUID = -8537766987566156228L;

        public PlatformRoleRevoked(String username, String platform, PlatformRole role) {
            super(username, platform, role);
        }
    }
}
